<?php
class anchor extends htmlcontainer {
	
	public function __construct($content = ''){
		parent::__construct($content);
		$this->tag = 'a';
		
		$this->validAttributes[] = 'charset';
		$this->validAttributes[] = 'coords';
		$this->validAttributes[] = 'href';
		$this->validAttributes[] = 'hreflang';
		$this->validAttributes[] = 'name';
		$this->validAttributes[] = 'rel';
		$this->validAttributes[] = 'rev';
		$this->validAttributes[] = 'shape';
		$this->validAttributes[] = 'target';
		$this->validAttributes[] = 'tabindex';
		$this->validAttributes[] = 'accesskey';
		$this->validAttributes[] = 'lang';
		
		$this->attributes['href'] = '';
	}

	public function getHref(){
		return $this->attributes['href'];
	}
	
	public function setHref($url){
		$this->attributes['href'] = $url;
	}
	
	public function href($url){
		$this->setHref($url);
	}
	
	public function getTarget(){
		return $this->attributes['target'];
	}
	
	public function setTarget($target){
		$this->attributes['target'] = $target;
	}
	
	public function target($target){
		$this->setTarget($target);
	}
		
	public function __toString(){
		if ( ! strlen($this->content)){
			$this->content = $this->attributes['href'];
		}
		return parent::__toString();
	}
}
?>